package hn.cch.dao.impl;

import hn.cch.jdbc.JdbcDao;
import hn.cch.dao.PlayDao;
import hn.cch.model.Play;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * Created by chench on 2020-5-21.
 */

@Component(value = "playDao")
public class PlayDaoImpl extends JdbcDao implements PlayDao {
    @Override
    public List<Play> getAll() {
        StringBuffer sql = new StringBuffer();
        sql.append("select play_id,play_type,play_ename from hot_openplay");
        List<Play> list = getAccessJdbcTemplate().query(sql.toString(), new BeanPropertyRowMapper(Play.class));
        return list;
    }
}
